package com.skycode6.dao;

import com.skycode6.bean.AdminBean;
import com.skycode6.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

public class AdminDao {
    DBConnection DBConn = new DBConnection();

    public boolean checkLogin(String s1,String s2)
        throws SQLException{
        // conn对象代表数据路链接
        Connection conn = DBConn.getConn();
        Statement stmt = conn.createStatement();
        ResultSet rs = null;
        boolean OK = true;
        String sql = "select * from admin where "+
                "AdminName = '" + s1 +"' and " +
                "AdminPwd = '" + s2 + "'";
        rs = stmt.executeQuery(sql);
        if (!rs.next()){
            OK = false;
        }
        return OK;
    }

    public int add(AdminBean adminBean) {
        DBConnection DBConn = new DBConnection();
        return 0;
    }

    public List<AdminBean> getList(int page) {
        DBConnection DBConn = new DBConnection();
        return null;
    }
}
